/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jianbo.proxy.util.khttp;

import java.util.Map;

/**
 * http客户端 提供以下三种请求方法
 * post(String url, Map data)
 * post(String url, string data)
 * post(String url, HttpServletRequest request)
 * 返回 HttpRequest 用户扩展
 * @author admin
 */
public class KHttp {
    
    /**
     * Http post 请求
     * @param url
     * @param param
     * @return 
     */
    public static HttpRequest post(String url, Map<String, Object> param) {
        return HttpRequest.post(url, param, true);
    }
    
    /**
     * Http get 请求
     * @param url
     * @param param
     * @return 
     */
    public static HttpRequest get(String url, Map<String, Object> param) {
        return HttpRequest.get(url, param, true);
    }
    
    /**
     * http get 请求 不带参数
     * @param url
     * @return 
     */
    public static HttpRequest get(String url) {
        return HttpRequest.get(url);
    }
    
    /**
     * http post 请求 不带参数
     * @param url 
     * @return  
     */
    public static HttpRequest post(String url) {
        return HttpRequest.post(url);
    }
    
    /**
     * http get 请求
     * @param url
     * @param data
     * @return 
     */
    public static HttpRequest get(String url, String data) {
        return HttpRequest.get(url + "?" + data);
    }
    
    /**
     * http post 请求
     * @param url
     * @param data 会附加回车符?
     * @return 
     */
    public static HttpRequest post(String url, String data) {
        return HttpRequest.post(url + "?" + data);
    }
    
}
